<template>
    <div class="TopDiv">
        <div class="logo" @click="goHome"></div>
        <div class="topRightBox">
            <img :src="getHeadImg()" alt="" srcset="">
            <el-popover placement="bottom" :width="100" trigger="hover">
                <template #reference>
                    <p>{{ getName() }}</p>
                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"
                        style="width: 10px;vertical-align: middle;">
                        <path fill="currentColor"
                            d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z">
                        </path>
                    </svg>
                </template>
                <p class="quitBtn" @click="quitFun">退出登录</p>
            </el-popover>


        </div>
    </div>
</template>

<script lang="ts" setup>
import { getPublic } from "../request/getPublic"; //获取静态资源
import { getName, getHeadImg, quit } from "../hooks/auth";
import router from "../router";

const goHome = () => {
    router.push({
        path: "Image"
    })
}
const quitFun = () => {
    quit()
    location.reload();

}
</script>

<style scoped>
.quitBtn {
    cursor: pointer;
    font-size: 10px;
    font-weight: 400;
    color: rgba(56, 56, 56, 1);
    text-align: center;
}

.logo {
    cursor: pointer;
    margin-left: 45px;
    width: 245px;
    height: 46px;
    background: url("/src/assets/topMenu/logo@3x.png") no-repeat;
    background-size: cover;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.topRightBox img {
    width: 32px;
    border-radius: 50%;
}

.topRightBox p,
.topRightBox svg {
    display: inline-block;
    transform: translateY(-50%);
    margin-left: 10px;
    font-size: 11px;
}

.topRightBox {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 24px;
    width: 145px;
    height: 32px;
}

.TopDiv {
    height: 100%;
    width: 100%;
    position: relative;

    background: rgba(251, 251, 251, 1);
    box-shadow: 0px 4px 10px rgba(78, 89, 105, 0.03);

}
</style>
